/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="favorites")
public class Favorites implements Serializable {
	public Favorites() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.Member member;
	
	private cn.imvc.app.entities.Goods goods;
	
	private String goodsName;
	
	private Integer goodsPrice;
	
	private int goodsNum;
	
	private String goodsImage;
	
	private cn.imvc.app.entities.GoodsSku sku;
	
	private String spec;
	
	private java.util.Date createdAt;
	
	private java.util.Date updatedAt;
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_FAVORITES_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_FAVORITES_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 商品名称
	 */
	public void setGoodsName(String value) {
		this.goodsName = value;
	}
	
	/**
	 * 商品名称
	 */
	@Column(name="goodsName", nullable=true, length=255)	
	public String getGoodsName() {
		return goodsName;
	}
	
	/**
	 * 商品价格
	 */
	public void setGoodsPrice(int value) {
		setGoodsPrice(new Integer(value));
	}
	
	/**
	 * 商品价格
	 */
	public void setGoodsPrice(Integer value) {
		this.goodsPrice = value;
	}
	
	/**
	 * 商品价格
	 */
	@Column(name="goodsPrice", nullable=true, length=10)	
	public Integer getGoodsPrice() {
		return goodsPrice;
	}
	
	/**
	 * 商品数量
	 */
	public void setGoodsNum(int value) {
		this.goodsNum = value;
	}
	
	/**
	 * 商品数量
	 */
	@Column(name="goodsNum", nullable=false, length=10)	
	public int getGoodsNum() {
		return goodsNum;
	}
	
	/**
	 * 商品图片
	 */
	public void setGoodsImage(String value) {
		this.goodsImage = value;
	}
	
	/**
	 * 商品图片
	 */
	@Column(name="goodsImage", nullable=true, length=255)	
	public String getGoodsImage() {
		return goodsImage;
	}
	
	/**
	 * 规格
	 */
	public void setSpec(String value) {
		this.spec = value;
	}
	
	/**
	 * 规格
	 */
	@Column(name="spec", nullable=true, length=255)	
	public String getSpec() {
		return spec;
	}
	
	public void setCreatedAt(java.util.Date value) {
		this.createdAt = value;
	}
	
	@Column(name="createdAt", nullable=true)	
	@Temporal(TemporalType.TIMESTAMP)	
	public java.util.Date getCreatedAt() {
		return createdAt;
	}
	
	public void setUpdatedAt(java.util.Date value) {
		this.updatedAt = value;
	}
	
	@Column(name="updatedAt", nullable=true)	
	@Temporal(TemporalType.TIMESTAMP)	
	public java.util.Date getUpdatedAt() {
		return updatedAt;
	}
	
	public void setMember(cn.imvc.app.entities.Member value) {
		this.member = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Member.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="memberId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Member getMember() {
		return member;
	}
	
	public void setGoods(cn.imvc.app.entities.Goods value) {
		this.goods = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Goods.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="goodsId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Goods getGoods() {
		return goods;
	}
	
	public void setSku(cn.imvc.app.entities.GoodsSku value) {
		this.sku = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.GoodsSku.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="skuId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.GoodsSku getSku() {
		return sku;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("Favorites[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getMember() != null)
				sb.append("Member.Persist_ID=").append(getMember().toString(true)).append(" ");
			else
				sb.append("Member=null ");
			if (getGoods() != null)
				sb.append("Goods.Persist_ID=").append(getGoods().toString(true)).append(" ");
			else
				sb.append("Goods=null ");
			sb.append("GoodsName=").append(getGoodsName()).append(" ");
			sb.append("GoodsPrice=").append(getGoodsPrice()).append(" ");
			sb.append("GoodsNum=").append(getGoodsNum()).append(" ");
			sb.append("GoodsImage=").append(getGoodsImage()).append(" ");
			if (getSku() != null)
				sb.append("Sku.Persist_ID=").append(getSku().toString(true)).append(" ");
			else
				sb.append("Sku=null ");
			sb.append("Spec=").append(getSpec()).append(" ");
			sb.append("CreatedAt=").append(getCreatedAt()).append(" ");
			sb.append("UpdatedAt=").append(getUpdatedAt()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
